package com.example.service.impl;

//import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.mapper.custom.PeopleMapper;
import com.example.mapper.master.UserMapper;
import com.example.model.People;
import com.example.model.User;
import com.example.service.MultiDataSourceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author long
 * @date 2024/9/4 9:45
 */
@Service
public class MultiDataSourceServiceImpl implements MultiDataSourceService {

    @Resource
    private UserMapper userMapper;

    @Resource
    private PeopleMapper peopleMapper;

    @Override
//    @TargetDs(dsName = "custom")
//    @DS("custom")
    public List<People> listPeople() {
//        QueryWrapper<People> queryWrapper = new QueryWrapper<>();
//        return peopleMapper.selectList(queryWrapper);

        return peopleMapper.listPeoples(null);
    }

    @Override
    public List<User> listUser() {
//        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
//        queryWrapper.lambda().between(User::getAge,1,2);
//        return userMapper.selectList(queryWrapper);

        return userMapper.listUsers(0,100000);
    }

}
